/* 公共函数*/

/**
 * 弹出框
 * @param {Object} type : 弹出框类型
 * @param {Object} url  : 弹出框Url
 */
function show_box(type, url){
	if(url!=''){
		 var url = '?url='+url;
	}
	if(type=='login'){
		var hg = 330;
		var width = 400;
		var url = '/Index/login'+url;
		var title = '账号登录';
	}else if(type=='reg'){
		var hg = 350;
		var width = 620;
		var url = '/Index/regist';
		var title = '用户注册';
	}else if(type=='user_logo'){
		var width = 650;
		var url = '/UserCenter/imgUpload';
		var title = '头像上传';
	}
	$.weeboxs.open(url, {
		title : title,
		contentType : 'ajax',
		showButton  : false,
		width  : width,
		height : hg
	});
}

/**
 * 提示框
 * @param {Object} text	: 提示信息 
 * @param {Object} type : 要触发的回调函数类型
 * @param {Object} content : 要显示的input框
 */
function showInfo(text, type, content){
	var html = "<div style='text-align:center;font-size:18px;line-height:120px;'>"+text+"</div>";
	var fn = '';
	switch (type){
		case 0:
			fn = content;
			break;
		case 1:
			fn = function(){window.location.href = content;}
			break;
		case 2:
			fn = function(){
				if(content!=''){$(content).focus();}
			}
			break;
		case 3:
			fn = function(){
					var captcha_url = '/index.php/Public/getCaptcha?_='+new Date().getTime();
					$(".login_form .login_captcha").prop('src', captcha_url);
					if(content!=''){$(content).focus();}
				}
			break;
		default:
			fn = fn
			break;
	}

	$.weeboxs.open(html, {
		title  : '系统提示',
		width  : 350,
		height : 120,
		showCancel: false, //是否显示取消按钮
		showOk	 : true, //是否显示确定按钮
		boxclass : 'weebox_prompt',
		onclose  : fn
	});
}